$(function() {
    $("body").i18n();
    $("#listGrid-toolbar").auth();
    $("#listGrid").datagrid({
        toolbar : '#listGrid-toolbar',
        data:[],
        pagination : true,
        pageSize : 10,
        rownumbers : true,
        striped : true,
        singleSelect : false,
        idField : 'id',
        nowrap : false,
        pagePosition : 'both',
        fitColumns : true,
        columns : [[{
            field : 'info',
            width : 300,
            title : $.i18n.get('secret.info')
        }]]
    });
    
    function getInfoRows() {
        var infos = this.infos;
        var rs = [];
        for (var i = 0; i < infos.length; i++) {
            rs.push({
                'info' : infos[i][0]
            });
        }
        return rs;
    }
    
    window.onMgmtSecSearch = function() {
        $("#listGrid").datagrid({
            url : contextPath + '/sample/findPageByMgmtSecret.arz',
            totalProperty : "total",
            rowsProperty : getInfoRows
        }).datagrid('clearSelections').datagrid('load', {});
    }
    
    window.onTopSecSearch = function() {
        $("#listGrid").datagrid({
            url : contextPath + '/sample/findPageByTopSecret.arz',
            totalProperty : "total",
            rowsProperty : getInfoRows
        }).datagrid('clearSelections').datagrid('load', {});
    }
});